
let a: string = 'String'
const b: number = 1
const c: boolean = Boolean(1)
const d: Boolean = new Boolean(1)
const e: void = null
const f: void = undefined
const g: undefined = undefined
const h: null = null
console.log(a,b,c,d,e,f,g,h)

let i: unknown = 1
let j: any = '1'
j = i
//a = i 直接报错ype 'unknown' is not assignable to type 'string'.
console.log(i,j)
let person: any = {a:2,b:'2'}
console.log(person.c)//undefined
let student:unknown = {d:1}
// student.e   TS2339: Property 'e' does not exist on type 'unknown'.

interface A{
    a:string
    b:number
    c?:any
    readonly d:number
    [propName: string] : any
    fun:()=>number

}

const k: A ={
    a:'1',
    b:2,
    d:1,
    kkk:true,
    kk:11,
    fun:()=>{
        return 1
    }
}
//k.d = 1   TS2540: Cannot assign to 'd' because it is a read-only property
console.log(k.kkk)
console.log(k.kk)
console.log(k.fun())

let arr1: string[] = ['1','2','3']
let arr2: Array<number> = [1,243,43524]
console.log(arr1)
console.log(arr2)
//接口描述
interface NumberArray{
    [index: number]:string
}
let arr3:NumberArray = ['2','2']
console.log(arr3)

function array(...args:any):void{
    console.log(arguments)
    //IArguments是TS内部定义的一个类型
    // interface IArguments {
    //     [index: number]: any;
    //     length: number;
    //     callee: Function;
    let arr4 :IArguments = arguments;
}
array(1,'2');



